<!-- Author: Phoo Pwint Khine --> 
<!-- Last Modified: 1 Sep 2012 --> 
<?php
	session_start();
	$_SESSION['upload'] = "true";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$uploaddir = './images/'; 
$file = $uploaddir.basename($_SESSION['visitorID'].$_FILES['image']['name']); 
$file_name=$_SESSION['visitorID'].$_FILES['image']['name']; 

 
if (move_uploaded_file($_FILES['image']['tmp_name'], $file)) { 
//require_once("../../classes/config.php");
  //require_once("../../classes/config.php");
  $connection=mysql_connect("localhost", "root", ""); 

//Select database, database_name needs to be changed 
	mysql_select_db("onestopjcu");
$sql=mysql_query("INSERT INTO `photoupload` (`photo_id`, `photo_date`, `photo_ip`, `photo_filename`) VALUES ('', '".date('d-m-Y')."', '".$_SERVER['REMOTE_ADDR']."', '$file_name');");
header("Location:Accom_editpost.php?img=".base64_encode($file_name)."");
} else {
header("Location:Accom_editpost.php?mgs=error");
}
?>
</body>
</html>